#coding=utf-8

#冒泡排序的几种方法
a = [1,2,1,4,6,8,7,5,9,2]
# b = a.copy()
# for i in range(0,len(a)):
#     c = max(a)
#     b[-i-1] = c
#     a.remove(c)
# print(b)
# for j in range(1,len(a)):
for i in range (0,len(a)-1):
    if a[i]>a[i+1]:
        a[i]=a[i]
        a[i + 1]=a[i+1]
    elif a[i] < a[i+1]:
        b = a[i]
        a[i]=a[i+1]
        a[i+1]=b
print(a)

# arr=[5,9,34,3,24,12,23,99]
# print(len(arr))
# for i in range(1,len(arr)):
#     for j in range(0,len(arr)-i):
#         if arr[j]<arr[j+1]:
#             c =arr[j+1]
#             arr[j+1] = arr[j]
#             arr[j] = c
#         print(arr)
#
#             # arr[j+1],arr[j]=arr[j],arr[j+1]
#
# print (arr)



